package com.example.mall.domain;

import java.util.Date;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.example.mall.util.CodeGenerateUtils;

import java.io.Serializable;

/**
 * <p>
 * 优惠券模板表
 * </p>
 *
 * @author whale
 * @since 2025-05-06
 */
@TableName("tb_coupon_template")
public class CouponTemplate extends Model<CouponTemplate> {

    private static final long serialVersionUID = 1L;

    /**
     * 模板唯一标识
     */
    @TableId("template_id")
    private Long templateId;
    /**
     * 优惠券名称
     */
    private String title;
    /**
     * 优惠券类型（1-满减，2-折扣，3-现金券）
     */
    private Integer type;
    /**
     * 使用规则（JSON格式）
     */
    @TableField("rule_json")
    private String ruleJson;
    /**
     * 使用平台（0-全平台，1-App，2-PC）
     */
    private Integer platform;
    /**
     * 来源类型（1-平台券，2-店铺券）
     */
    @TableField("source_type")
    private Integer sourceType;
    /**
     * 发放总量
     */
    private Integer total;
    /**
     * 剩余总量
     */
    private Integer remaining;
    /**
     * 有效期类型（1-固定日期，2-领取后生效）
     */
    @TableField("valid_type")
    private Integer validType;
    /**
     * 有效期开始时间
     */
    @TableField("valid_start_time")
    private Date validStartTime;
    /**
     * 有效期结束时间
     */
    @TableField("valid_end_time")
    private Date validEndTime;
    /**
     * 领取后有效天数
     */
    @TableField("valid_days")
    private String validDays;
    /**
     * 适用范围（0-全场，1-指定品类，2-指定商品）
     */
    @TableField("apply_range")
    private Integer applyRange;
    /**
     * 状态（1-待发放，2-发放中，3-已暂停）
     */
    @TableField("coupon_status")
    private Integer couponStatus;
    /**
     * 创建时间
     */
    @TableField("create_date")
    private Date createDate;
    /**
     * 更新时间
     */
    @TableField("update_date")
    private Date updateDate;

    public CouponTemplate() {
        this.templateId = Long.valueOf(CodeGenerateUtils.generateUniqueId());
    }

    public Long getTemplateId() {
        return templateId;
    }

    public void setTemplateId(Long templateId) {
        this.templateId = templateId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getRuleJson() {
        return ruleJson;
    }

    public void setRuleJson(String ruleJson) {
        this.ruleJson = ruleJson;
    }

    public Integer getPlatform() {
        return platform;
    }

    public void setPlatform(Integer platform) {
        this.platform = platform;
    }

    public Integer getSourceType() {
        return sourceType;
    }

    public void setSourceType(Integer sourceType) {
        this.sourceType = sourceType;
    }

    public Integer getTotal() {
        return total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

    public Integer getRemaining() {
        return remaining;
    }

    public void setRemaining(Integer remaining) {
        this.remaining = remaining;
    }

    public Integer getValidType() {
        return validType;
    }

    public void setValidType(Integer validType) {
        this.validType = validType;
    }

    public Date getValidStartTime() {
        return validStartTime;
    }

    public void setValidStartTime(Date validStartTime) {
        this.validStartTime = validStartTime;
    }

    public Date getValidEndTime() {
        return validEndTime;
    }

    public void setValidEndTime(Date validEndTime) {
        this.validEndTime = validEndTime;
    }

    public String getValidDays() {
        return validDays;
    }

    public void setValidDays(String validDays) {
        this.validDays = validDays;
    }

    public Integer getApplyRange() {
        return applyRange;
    }

    public void setApplyRange(Integer applyRange) {
        this.applyRange = applyRange;
    }

    public Integer getCouponStatus() {
        return couponStatus;
    }

    public void setCouponStatus(Integer couponStatus) {
        this.couponStatus = couponStatus;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }


    @Override
    public String toString() {
        return "CouponTemplate{" +
        ", templateId=" + templateId +
        ", title=" + title +
        ", type=" + type +
        ", ruleJson=" + ruleJson +
        ", platform=" + platform +
        ", sourceType=" + sourceType +
        ", total=" + total +
        ", remaining=" + remaining +
        ", validType=" + validType +
        ", validStartTime=" + validStartTime +
        ", validEndTime=" + validEndTime +
        ", validDays=" + validDays +
        ", applyRange=" + applyRange +
        ", couponStatus=" + couponStatus +
        ", createDate=" + createDate +
        ", updateDate=" + updateDate +
        "}";
    }
}
